/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Records.Attributes;

import Records.Main.RecordsMain;
import java.util.ArrayList;
import java.util.LinkedList;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Alexander
 */
public class LibraryDataSets {

    private static String Song_ID;
    private static String title;
    private static String bpm;
    private static String genre;
    private static String danceability;
    private static String energy;
    private static String acousticness;
    private static String key;
    private static String Location;
    private static String FilePath;
    private static String album;
    private static String image;
    private static String artist;

    public LibraryDataSets(ArrayList set) {
        this.Song_ID = set.get(0).toString();
        this.title = set.get(1).toString();
        this.artist = set.get(2).toString();
        this.album = set.get(3).toString();
        this.genre = set.get(4).toString();
        this.energy = set.get(5).toString();
        this.danceability = set.get(6).toString();
        this.acousticness = set.get(7).toString();
        this.bpm = set.get(8).toString();
        this.key = set.get(9).toString();
        this.image = set.get(10).toString();
        this.FilePath = set.get(11).toString();
        this.Location = "Directory";
    }

    public void InsertLibraryData() {
        System.out.println("LibraryDataSets.InsertLibraryData()");
        RecordsMain.dba.insertIntoLibSongs(getSong_ID(), getTitle(), getBpm(), getGenre(), getDanceability(), getEnergy(), getAcousticness(), getKey(), getLocation(), getFilePath());
        RecordsMain.dba.insertIntoLibAlbums(getSong_ID(), getAlbum(), getImage());
        RecordsMain.dba.insertIntoLibArtists(getSong_ID(), getArtist());
        RecordsMain.dba.insertIntoLibFilePaths(getSong_ID(), getFilePath());
        addRow(getTitle(), getArtist(), getAlbum(), getGenre(), getEnergy(), getDanceability(), getAcousticness(), getBpm(), getKey());
    }

    public static void addRow(String title, String artist, String album, String genre, String energy, String danceability, String acousticness, String bpm, String key) {
        System.out.println("LibraryDataSets.addRow(" + title + ", " + artist + ", " + album + ", " + genre + ", " + energy + ", " + danceability + ", " + acousticness + ", " + bpm + ", " + key + ")");
        DefaultTableModel model = (DefaultTableModel) RecordsMain.getUI().userLibrary.getModel();
        LinkedList<Object> songDetails = new LinkedList<>();
        // Build a Vector of Strings for the table row
        songDetails.add(title);
        songDetails.add(artist);
        songDetails.add(album);
        songDetails.add(genre);
        songDetails.add(energy);
        songDetails.add(danceability);
        songDetails.add(acousticness);
        songDetails.add(bpm);
        songDetails.add(key);

        model.addRow(songDetails.toArray());
        RecordsMain.getUI().NumSongs.setText("" + model.getRowCount() + " Songs");
    }

    /**
     * @return the Song_ID
     */
    public static String getSong_ID() {
        return Song_ID;
    }

    /**
     * @return the title
     */
    public static String getTitle() {
        return title;
    }

    /**
     * @return the bpm
     */
    public static String getBpm() {
        return bpm;
    }

    /**
     * @return the genre
     */
    public static String getGenre() {
        return genre;
    }

    /**
     * @return the Danceability
     */
    public static String getDanceability() {
        return danceability;
    }

    /**
     * @return the Energy
     */
    public static String getEnergy() {
        return energy;
    }

    /**
     * @return the Acousticness
     */
    public static String getAcousticness() {
        return acousticness;
    }

    /**
     * @return the key
     */
    public static String getKey() {
        return key;
    }

    /**
     * @return the Location
     */
    public static String getLocation() {
        return Location;
    }

    /**
     * @return the FilePath
     */
    public static String getFilePath() {
        return FilePath;
    }

    /**
     * @return the album
     */
    public static String getAlbum() {
        return album;
    }

    /**
     * @return the image
     */
    public static String getImage() {
        return image;
    }

    /**
     * @return the artist
     */
    public static String getArtist() {
        return artist;
    }
}
